{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## numpy与python原生性能比较\n",
    "> 考察一个包含一百万整数的数组,各个序列分别乘以2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "my_arr = np.arange(1000000)\n",
    "%time for _ in range(10): my_arr2 = my_arr * 2\n",
    "\n",
    "my_list = list(range(1000000))\n",
    "%time for _ in range(10): my_list2 = [x * 2 for x in my_list]"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "3207008acf26a07c58f9163727980777c0d92fa298586eda8a314250b7931cb4"
  },
  "kernelspec": {
   "display_name": "Python [conda env:pybd] *",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.10"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
